C-Level Extensibility > The C-level extensibility API > JSBool JS_GetElement()

 

JSBool JS_GetElement()

Description

Reads a single element of an array object.

Arguments

JSContext *cx, JSObject *obj, unsigned int index, jsval *v

cx is the opaque JSContext pointer that was passed to the JavaScript function.
obj is a pointer to an array object.
index is an integer index into the array. The first element is index 0, and the last element is index (length - 1).
v is a pointer to a jsval where the contents of the jsval in the array should be copied.

Returns

A Boolean value indicating success (JS_TRUE) or failure (JS_FALSE).